Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] riscv: Add sysarch(2) support for utidc #2142

Closed
wants to merge 12 commits into from
Closed

[WIP] riscv: Add sysarch(2) support for utidc #2142

wants to merge 12 commits into from

Conversation

dpgao
Copy link
Contributor

@dpgao dpgao commented Jul 4, 2024

Currently calling sysarch(RISCV_SET_UTIDC, ptr) doesn't actually set the register. What's missing?

Not sure why CI is failing. It works fine locally on QEMU.

@dpgao dpgao force-pushed the c18n-riscv branch 2 times, most recently from 90e55eb to 88de6f9 Compare July 16, 2024 16:37
@dpgao dpgao force-pushed the c18n-riscv branch 3 times, most recently from 02ae512 to f40eab0 Compare July 24, 2024 10:57
@dpgao dpgao force-pushed the c18n-riscv branch 2 times, most recently from bd61e01 to 1987963 Compare August 12, 2024 14:38
dpgao added 2 commits August 19, 2024 14:41
CHERI_LIB_C18N is only ever defined under the purecap ABI, so there is
no need to separately check for the purecap ABI.
_rtld_unw_getcontext_epilogue is removed because when c18n is not
enabled, the trusted stack field of the unwind cursor is unused anyway,
so there's no need to fill it.

_rtld_unw_setcontext is no longer in assembly because it is now expected
to be called before all registers are restored, so it does not need to
restore any register.

setjmp and longjmp are updated to use the slightly changed API
signatures.
@dpgao dpgao force-pushed the c18n-riscv branch 2 times, most recently from 1b24f97 to 910f5b4 Compare August 21, 2024 11:01
dpgao added 10 commits August 21, 2024 17:53
Previously, libunwind hard-codes knowledge about the layout of the
trusted frame and has read access to the trusted stack. This is fragile
and insecure.

Now, the task of extracting the relevant registers from the trusted
stack is delegated to RTLD, and libunwind no longer has access to the
trusted stack.

In addition, unify the APIs exposed to setjmp/longjmp and libunwind.
Assembly stubs for _rtld_unw_{get,set}context are removed. Instead, turn
calls to these functions into no-ops when they are not defined by RTLD.
In the following example, bar makes a tail-call to foo, which returns a
value that is observable to the caller of bar, even though bar returns
nothing.

    void *foo();
    void bar() { foo(); }

When bar is called, previous versions of the trampoline clears return
value registers as if foo is being called directly, leaking a
capability. Instead, clear the maximum number of return value registers
as required for both foo and bar.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant